﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
 Inherits="System.Web.Mvc.ViewPage<IntellectShop.Web2.Hardware.ViewModels.HardwareTagedViewModel>" %>
<%@ Import Namespace="IntellectShop.Web2.Hardware.Code" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%= Html.Resource("BrowsingCategory") %>: <%= Html.Encode(Model.Category.Name) %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<script type="text/javascript" src='<%= ResolveUrl("~/Scripts/live.filter.1.2/jquery.liveFilter.min.js")%>'></script>
	<script type="text/javascript">
		$(document).ready(function () {
			$('table.live_filter').liveFilter('fade');
		});
	</script>

	<h1><%= Html.Resource("BrowsingCategory") %>: <%= Html.Encode(Model.Category.Name)%></h1>
	<div class="innerArticle">
		<% Html.RenderAction("ViewBody", "PageContent", new { pageContentUniqName = IntellectShop.Common.PageContentUniqName.HardwareBrowse }); %>
	</div>
	<% if (Model.HardwareTagged.Any())
	{ %>
	<p>
		<%= Html.Resource("Strings, LiveSearch") %>:
		<input class="filter" name="livefilter" type="text" value="" />
	</p>
	<table class="live_filter hovered">
		<% foreach (var tag in Model.HardwareTagged.Keys) %>
		<% { %>
			<% if (!String.IsNullOrEmpty(tag) || Model.HardwareTagged.Keys.Count > 1) %>
			<% { %>
			<tr>
				<th colspan="3" style="font-size: 13px;">
					<% IntellectShop.Common.TagsSet set = IntellectShop.Common.TagsSet.GetFavoritesTags(Model.HardwareTagged[tag]); %>
					<% for (int i = 0; i < set.Count; i++) %>
					<% {%>
						<span style="margin-left: 0px;margin-right: 6px;">
							<%= Html.ActionLink(Html.Encode(set[i]), "Browse", "Tags", new { tag = set[i] }, new { style = "color: #ffffff;" })%>
						</span>
						<% if (i < set.Count - 1) %>
						<% { %>
						,
						<% } %>
					<% } %>
				</th>
			</tr>
			<% } %>
			<tr>
				<td class="subheader">
					<%= Html.LabelFor(model => model.HardwareTagged.FirstOrDefault().Value.FirstOrDefault().Code)%>
				</td>
				<td class="subheader">
					<%= Html.LabelFor(model => model.HardwareTagged.FirstOrDefault().Value.FirstOrDefault().Name)%>
				</td>
				<td class="subheader">
					<%= Html.LabelFor(model => model.HardwareTagged.FirstOrDefault().Value.FirstOrDefault().Price)%>
				</td>
			</tr>
			<% foreach (var each in Model.HardwareTagged[tag])
			{ %>
			<tr class="clickable"
				onclick='javascript: document.location.href = $("td strong a", $(this)).attr("href"); return false;'>
				<td style="text-align: right;">
					<div style="width: 160px; padding: 3px; overflow: hidden;">
						<strong>
							<%= Html.ActionLink(
									each.Code,
									"Details", "Hardware",
									new { id = each.CommodityID }, null)%>
						</strong>
					</div>
				</td>
				<td>
					<a name="id<%= each.CommodityID %>"></a>
					<div style="width: 320px; overflow: hidden;">
						<%= each.ToString() %>
					</div>
				</td>
				<td style="white-space:nowrap; text-align: right;">
					<%= Html.Encode(each.Price)%>
				</td>
			</tr>
			<% } %>
		<%} %>
	</table>
	<% } %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="SecondInfo" runat="server">
	<div class="sidebaritem">
		<% Html.RenderPartial("SubmenuStore"); %>
	</div>
</asp:Content>
